/*
 * (C) Copyright 2013 Aepona Limited. All Rights Reserved.
 *
 * These materials are unpublished, proprietary, confidential source code of Aepona Limited and constitute a
 * TRADE SECRET of Aepona Limited.
 *
 * Aepona Limited retains all title to and intellectual property rights in these materials.
 */

package com.intel.sam.modulePartnerIntegration.functional;


import com.intel.sam.modulePartnerIntegration.client.AppWS;
import com.intel.sam.modulePartnerIntegration.client.AppWSImplService;

import javax.xml.ws.WebServiceException;


/**
 * Created by IntelliJ IDEA.
 * User: tg40286
 * Date: Mar 21, 2012
 * Time: 5:42:04 PM
 */
public class AppWSC
{

    AppWS appWS;

    public AppWSC()
    {

        try
        {
            appWS = new AppWSImplService().getAppWSImplPort();
        }
        catch ( WebServiceException e )
        {
            System.out.println( "Failed to access the Web Server !! \n" + e.toString() );
        }
    }

    public String loginWS( String username, String password )
    {

        try
        {
            return appWS.doLogin( username, password );
        }
        catch ( NullPointerException ex )
        {
            return "-99|Connection Fail";
        }
        catch ( Exception ex )
        {
            System.out.println( ex.toString() );
            return "-99|Connection Fail";
        }
    }
}
